# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/25 下午5:29
 @Author  : tgy
 
"""

class Person:
    __slots__ = ['name', 'age']
    def __init__(self,name,age):
        self.name = name
        self.age = age

    def __dict__(self):

        import sys
        print(sys._getframe(0).f_locals)
        return {key:getattr(self,key) for key in self.__slots__}

def test01():
    ...
    format = 'name:{name},age:{age}'
    print(format.format(name='zhangsan', age=21))
    # print(vars())
    name ='tony'
    age =21
    print(format.format_map(vars()))
    person = Person('mick', 30)
    # print(person.__dict__())
    print(vars(person))
    format.format_map(vars(person))


def test02():
    ...
    person = Person('zhangsan', '23')
    print(person.__dict__())

if __name__ == '__main__':
    ...
    test02()
    # name = 20
